#include "lastStoneWeight.h"
int lastStoneWeight(std::vector<int> &stones) {
<<<<<<< HEAD:cxx/algorithm/src/lastStoneWeight.cc
    std::priority_queue<int> pq;
    for (auto e:stones)
        pq.emplace(e);
    while (pq.size() >= 2) {
        int max_value = pq.top();
        pq.pop();
        int second_value = pq.top();
        pq.pop();
        if (max_value > second_value)
            pq.push(max_value - second_value);

    }
    return pq.size()==1?pq.top():0;
=======
  std::priority_queue<int> pq;
  for (auto e : stones) pq.emplace(e);
  while (pq.size() >= 2) {
    int max_value = pq.top();
    pq.pop();
    int second_value = pq.top();
    pq.pop();
    if (max_value > second_value) pq.push(max_value - second_value);
  }
  return pq.size() == 1 ? pq.top() : 0;
>>>>>>> dev:cxx/algorithm/common/src/lastStoneWeight.cc
}
